#import "AuthorizatModel.h"
#import "AuthorizatTool.h"
@interface AuthorizatModel()
@property (nonatomic,strong)AuthorizatTool *tool;
@end
@implementation AuthorizatModel
- (instancetype)initWithTitle:(NSString *)title subTitle:(NSString *)subTitle image:(NSString *)imgName type:(AuthorizatType)type{
    self = [super init];
    if (self) {
        _titleStr = [NSString stringWithFormat:@"%@",title];
        _subtitleStr = [NSString stringWithFormat:@"%@",subTitle];
        _imageName = [NSString stringWithFormat:@"%@",imgName];
        _type = type;
        [self checkAuthorizat];
    }
    return self;
}
- (void)checkAuthorizat{
    switch (_type) {
        case AuthorizatTypePhoto:{    
            _isOpen = [AuthorizatTool isOpenPhoto];
        }break;
        case AuthorizatTypeCamera:{   
            _isOpen = [AuthorizatTool isOpenCamera];
        }break;
        case AuthorizatTypeAudio:{    
            _isOpen = [AuthorizatTool isOpenAudio];
        }break;
        case AuthorizatTypeReminder:{ 
            _isOpen = [AuthorizatTool isOpenReminder];
        }break;
        case AuthorizatTypeRessBook:{ 
            _isOpen = [AuthorizatTool isOpenRessBook];
        }break;
        case AuthorizatTypeEvent:{    
            _isOpen = [AuthorizatTool isOpenEvent];
        }break;
        case AuthorizatTypeNotication:{
            _isOpen = [AuthorizatTool isOpenNotificat];
        }break;
        case AuthorizatTypeLocation:{  
            _isOpen = [AuthorizatTool isOpenLocation];
        }break;
        default:
            break;
    }
}
- (void)openAuthorizatWithBlock:(void(^)(BOOL open))block{
    switch (_type) {
        case AuthorizatTypePhoto:{    
            [AuthorizatTool openPhotoWithBlock:block];
        }break;
        case AuthorizatTypeCamera:{   
            [AuthorizatTool openVideoWithBlock:block];
        }break;
        case AuthorizatTypeAudio:{    
            [AuthorizatTool openAudioWithBlock:block];
        }break;
        case AuthorizatTypeReminder:{ 
            [AuthorizatTool openReminderWithBlock:block];
        }break;
        case AuthorizatTypeRessBook:{ 
            [AuthorizatTool openRessBookWithBlock:block];
        }break;
        case AuthorizatTypeEvent:{    
            [AuthorizatTool openEventWithBlock:block];
        }break;
        case AuthorizatTypeNotication:{
            [AuthorizatTool openNotificatWithBlock:block];
        }break;
        case AuthorizatTypeLocation:{  
            _tool = [[AuthorizatTool alloc]init];
            [_tool openLocationWithBlock:block];
        }break;
        default:
            break;
    }
}
@end
